<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
    <script>
        console.log(1); 
        console.log(new Date,"Date 12");
        console.log(2);

        for (var i = 0; i < 3; i++) {
            // 3个异步任务
            setTimeout(function () {
                console.log("timer:",new Date);
            }, 1000 * i);
        }

        console.log(3);
        console.log(new Date,"Date 34");
        console.log(4);
        //1
        //Wed May 11 2022 09:36:55 GMT+0800 (中国标准时间) 'Date 12'
        //2
        //3
        //Wed May 11 2022 09:36:55 GMT+0800 (中国标准时间) 'Date 34'
        //4
        // timer: Wed May 11 2022 09:36:55 GMT+0800 (中国标准时间)
        // timer: Wed May 11 2022 09:36:56 GMT+0800 (中国标准时间)
        // timer: Wed May 11 2022 09:36:57 GMT+0800 (中国标准时间)
        
    </script>
</body>

</html>